package com.yjtravel.u70;

/**
 * @author weiqi
 * @version 1.0
 * Create by 2024/7/30 9:10
 */
public class InputText {

   private final StringBuilder sb = new StringBuilder();

    public String getText(){
        return sb.toString();
    }

   public void append(String input){
       sb.append(input);
   }

   public Snapshot createSnapshot(){
        return new Snapshot(sb.toString());
   }

   public void restoreSnapshot(Snapshot snapshot){
        sb.replace(0, sb.length(), snapshot.getText());
   }
}
